package org.example;

import cn.hutool.core.lang.Console;
import io.grpc.Server;
import io.grpc.ServerBuilder;
import lombok.SneakyThrows;
import org.example.service.TestFirstService;

public class StudyGrpc2ServiceMain {

    @SneakyThrows
    public static void main(String[] args) {

        // 1. 创建服务
        Server server = ServerBuilder
                .forPort(9999)
                .addService(new TestFirstService())
                .build();
        Console.log("创建Grpc服务");

        // 2. 启动服务，并等待请求接收
        server.start();
        Console.log("Grpc服务启动并等待请求接收");
        server.awaitTermination();


    }
}